package com.jm.day24.d_demo2;

import com.jm.day24.d_demo2.service.AccountService;

/**
 *
 * 这种转账没有进行事务控制，结果就是如果转账出现异常，就可能会导致数据出现问题：比如，转账失败，但张三扣钱成功，李四 收钱失败
 * @author liuyp
 *
 */
public class AccountTest {
    public static void main(String[] args) {
        //定义参数
        String out = "zhangsan";
        String in = "lisi";
        Double money = 500d;

        //执行转账
        AccountService service = new AccountService();
        boolean isSuccess = service.transfer(out, in ,money);

        //结果
        if(isSuccess){
            System.out.println("成功");
        }else {
            System.out.println("失败");
        }
    }
}
